// TDPsolaView.cpp : implementation of the CTDPsolaView class
//

#include "stdafx.h"
#include "TDPsola.h"

#include "TDPsolaDoc.h"
#include "TDPsolaView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaView

IMPLEMENT_DYNCREATE(CTDPsolaView, CView)

BEGIN_MESSAGE_MAP(CTDPsolaView, CView)
	//{{AFX_MSG_MAP(CTDPsolaView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaView construction/destruction

CTDPsolaView::CTDPsolaView()
{
	// TODO: add construction code here

}

CTDPsolaView::~CTDPsolaView()
{
}

BOOL CTDPsolaView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaView drawing

void CTDPsolaView::OnDraw(CDC* pDC)
{
	CTDPsolaDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CBrush *pBrush[256];
	CRect rcClient;
	GetClientRect(&rcClient);
	for(int i = 0 ; i < 256 ; i++)
	{
		pBrush[i] = new CBrush(RGB(0,255-i,255-i));
	}
	for( i = 0; i < rcClient.Height();i++)
	{
		pDC->FillRect(CRect(0,i,rcClient.Width(),i+1),pBrush[i*256/rcClient.Height()]);
	}
	for(i = 0; i < 256 ; i++)
	{
		delete pBrush[i];
	}
}

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaView printing

BOOL CTDPsolaView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CTDPsolaView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CTDPsolaView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaView diagnostics

#ifdef _DEBUG
void CTDPsolaView::AssertValid() const
{
	CView::AssertValid();
}

void CTDPsolaView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CTDPsolaDoc* CTDPsolaView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTDPsolaDoc)));
	return (CTDPsolaDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTDPsolaView message handlers
